<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>文章的修改</title>
<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/EasyUI/jquery-ui.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/EasyUI/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/EasyUI/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/EasyUI/themes/icon.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/EasyUI/locale/easyui-lang-zh_CN.js"></script>
</head>

<body>
		<!-- 配置文件 -->
		<script type="text/javascript" src="${pageContext.request.contextPath }/static/ueditor/ueditor.config.js" charset="utf-8"></script>
		<!-- 编辑器源码文件 -->
		<script type="text/javascript" src="${pageContext.request.contextPath }/static/ueditor/ueditor.all.min.js" charset="utf-8"></script>
		
		
		
	<div id="p" class="easyui-panel" title="编写文章" style="padding: 10px">
		<form id="form1" action="${pageContext.request.contextPath }/admin/article/update.do" enctype="multipart/form-data" method="post">
	 	<table cellspacing="20px">
	 		<input type="hidden" name="articleId"  value="${article.articleId }" />
	 		<input type="hidden" name="articleTime"  value="${article.articleTime }" />
	 		<input type="hidden" name="articleAuthor"  value="${article.articleAuthor }" />
	 		<input type="hidden" name="clickhit"  value="${article.clickhit }" />
	   		<tr>
	   			<td width="80px">文章标题：</td>
	   			<td><textarea type="text" id="title" name="articleName" style="width: 400px; height: 40px">${article.articleName }</textarea></</td>
	   		</tr>
	   		<tr>
	   			<td>文章简介:</td>
	   			<td><textarea type="text" id="summary" name="articleSummary" style="width: 400px; height: 80px">${article.articleSummary }</textarea></td>
	   		</tr>
	   		<tr>
	   			<td>文章类型</td>
	   			<td>
	   				<select style="width: 154px" id="artilceTypeId" name="typeId" editable="false" panelHeight="auto" >
						<option value="">请选择文章类别...</option>	
					    <c:forEach var="Type" items="${ArticleType }">
					    	<option value="${Type.typeId }">${Type.typeName }</option>
					    </c:forEach>			
               		</select>
	   			</td>
	   		</tr>
	   		<tr>
	   			<td>文章上传的图片</td>
	   			<td> 
	   				<input type="file" name="articlefile" id="articleimg" /> <a style="color: red;">智障注意！ 最多上传大小8MB图片 </a>${article.articleImg }
	   			</td>
	   		</tr>
	   		<tr>
	   			<td>文章内容：</td>
	   			<td>
					   <div name="articleContent" style="width:800px;margin:20px auto 40px;">
					   <script type="text/plain" id="editor" name="articleContent" style="width:100%;height:200px;">
							${article.articleContent}
						</script>
						</div>
	   			</td>
	   		</tr>
	   		<tr>
	   			<td></td>
	   			<td>
	   				<!-- <a href="javascript:void(0);" onclick="submitData()" class="easyui-linkbutton" data-options="iconCls:'icon-submit'">发表文章</a> -->
	   				<input type="submit" value="提交" />
	   			</td>
	   		</tr>
	   	</table>
	   	</form>
	 </div>
	 <script type="text/javascript">
	 
	 var ue = UE.getEditor('editor');

	</script>
	<script type="text/javascript">
		$("#form1").submit(function(event){
		    var articleContent = UE.getEditor('editor').getContent();
			var articleSummary = $("#summary").val();
			 var typeId=$("#artilceTypeId").val();
			if($("#title").val()==null || $("#title").val()=="" || $("#title").val().length > 32)
			{
				alert('请输入标题');
				return false;
			}
			 else if(articleSummary==null || articleSummary =="" || articleSummary.length > 128)
			{
				alert("请输入文章简介");
				return false;
			} 
			else if(typeId==null || typeId =="")
			{
				alert("请选择文章类型");
				return false;
			}
			else if(articleContent==null || articleContent =="")
			{
				alert("请输入内容");
				return false;
			}
			else
			{
				return true;
				alert("提交成功!");
			}    
			});
		</script>
</body>
</html>
